package test;

import com.swotxu.bean.Car;
import com.swotxu.config.MainConfigOfLifeCycle;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class IOCTest_LifeCycle {

    public AnnotationConfigApplicationContext context1;
    @Before
    public void befor() {
        context1 = new AnnotationConfigApplicationContext(MainConfigOfLifeCycle.class);
        System.out.println("容器创建完成。。");
    }
    @Test
    public void test01() {
        Car bean = context1.getBean(Car.class);
        System.out.println(bean);
        context1.close();
    }
    @Test
    public void test02() {
        //关闭容器
        context1.close();
    }
}
